package application;

import java.util.Arrays;

public class ExampleUseCase {

	public static void main(String[] args) {
		// Shows use case where dive plan is:
		// Dive 1 - 130 ft for 25 min
		// break for 52 min
		// Dive 2 - 50 ft for 4 min
		// break for 10 min
		// Dive 3 - 40 ft for 14 min
		// break for 1440 (aka 1 day)
		// Dive 4 - 130 ft for 5 min
		// it can continue on forever so long as the dives are possible
		// if the dives are not possible the code will break
		// the code for the DivePlanner and the tables assumes that the GUI will
		// handle
		// the input values

		DivePlanner planner = new DivePlanner();

		// Dive 1
		System.out.println("Dive 1");

		NAUITable table = planner.addFirstDive(130, 25);

		System.out.println(isTable(table));
		System.out.println(Arrays.deepToString(planner.getPlanner().toArray()));
		System.out.println();

		// Dive 2
		System.out.println("Dive 2");

		// before every next dive, GUI must prompt SIT from user
		planner.setUserSIT(52);

		// then the GUI must prompt for the next depth and time
		planner.setUserDepthAndTime(50, 4);

		table = planner.addRepetitiveDive(table);

		System.out.println(isTable(table));
		System.out.println(Arrays.deepToString(planner.getPlanner().toArray()));
		System.out.println();

		// Dive 3
		System.out.println("Dive 3");

		// before every next dive, GUI must prompt SIT from user
		planner.setUserSIT(10);

		// then the GUI must prompt for the next depth and time
		planner.setUserDepthAndTime(40, 14);

		table = planner.addRepetitiveDive(table);

		System.out.println(isTable(table));
		System.out.println(Arrays.deepToString(planner.getPlanner().toArray()));
		System.out.println();

		// Dive 4
		System.out.println("Dive 4");

		// before every next dive, GUI must prompt SIT from user
		planner.setUserSIT(1440);

		// then the GUI must prompt for the next depth and time
		planner.setUserDepthAndTime(130, 5);

		table = planner.addRepetitiveDive(table);

		System.out.println(isTable(table));
		System.out.println(Arrays.deepToString(planner.getPlanner().toArray()));
		System.out.println();

	}

	public static String isTable(NAUITable table) {
		if (table instanceof FirstNAUITable) {
			return "1";
		} else if (table instanceof SecondNAUITable) {
			return "2";
		} else {
			return "3";
		}
	}

}
